package com.sjyp.cms.controller.fornt;

import com.jfinal.core.Controller;
import com.sjyp.cms.model.Article;

import java.util.List;

/**
 * 合作 & 加盟
 */
public class CooperationController extends Controller {
    public void index() {
        //获取所有文档
        String titleSql = "select id,title from t_article " +
                "where columnId=7 " +
                "order by orderNo asc";
        List<Article> articleTitles = Article.dao.find(titleSql);
        this.setAttr("articleTitles", articleTitles);
        int articleId = this.getParaToInt("articleId",articleTitles.get(0).getId());
        String contextSql = "SELECT t_article.id,t_article.title,t_article.subtitle,t_article.summary,t_article.content,t_article.columnId,t_article.createDate,t_article.orderNo " +
                "FROM t_article where id=?";
        Article article = Article.dao.findFirst(contextSql,articleId);
        this.setAttr("articleId", articleId).setAttr("article", article);
        this.render("cooperation.html");
    }
}
